public class Numbers
{
   /**
      Counts the number of 7s in a given number
      @param num a number >= 0
      @return the number of digits in num that are 7
   */
   public static int countSevens(int num)
   {
      int sum = 0;
      while( num != 0)
      {
         if( num % 10 == 7)
         {
            sum++;
         }
         num /= 10;
      }
      return sum;
   }
}